
export const defaultState = []

export function reducer (state = [], action) {
    const {type, data} = action
   switch (type) {
       case 'add':
           return [...state, data];
       case 'dele':
           if (state.length !== 0 && state.includes(data)) {
				let index = state.findIndex(item => item === data)
				state.splice(index, 1)
			}
           return [...state]
		default:
			return state
   }    
}




